﻿/*----------------------------------------------------------------
    // Copyright (C) 2009 江苏华招网
    // 版权所有。 
    // 作者：庄金冬 
    //
    // 文件名：IBLL_ProcurementBasic.cs
    // 文件功能描述：有关采购基础（为交易做准备）的业务逻辑接口
    // 创建标识：庄金冬2009-03-06
    //
    // 修改标识：
    // 修改描述：
    //
    // 修改标识：
    // 修改描述：
    //
    // 审核人：
    // 审核时间：
    // 审核说明：
 //----------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using HZ.DrugTrade.Model;
namespace HZ.DrugTrade.IBLL
{
    /// <summary>
    /// 有关采购基础（为交易做准备）的业务逻辑接口
    /// </summary>
    public interface IBLL_ProcurementBasic
    {
        #region 采购项目
        /// <summary>
        /// 获取所有采购项目
        /// </summary>
        /// <returns>所有采购项目信息</returns>
        /// <remarks>
        /// 获取所有采购项目
        /// </remarks>
        IList<ProcurementProject> GetAllProcurementProject();

        /// <summary>
        /// 采购项目条件查询（有效的【在采购项目有效期内】）
        /// </summary>
        /// <param name="project">查询用实体</param>
        /// <param name="currentPage">当前页</param>
        /// <param name="pageSize">每页显示记录数</param>
        /// <param name="totalRecord">（输出参数）总记录数目</param>
        /// <returns></returns>
        IList<ProcurementProject> GetProjectByWhere(ProcurementProject project, int currentPage, int pageSize, out int totalRecord);

        /// <summary>
        /// 采购项目条件查询（无效的【不在采购项目有效期内】）
        /// </summary>
        /// <param name="project">查询用实体</param>
        /// <param name="currentPage">当前页</param>
        /// <param name="pageSize">每页显示记录数</param>
        /// <param name="totalRecord">（输出参数）总记录数目</param>
        /// <returns></returns>
        IList<ProcurementProject> GetInvalidProjectByWhere(ProcurementProject project, int currentPage, int pageSize, out int totalRecord);

        /// <summary>
        /// 添加采购项目信息（0失败;1成功）
        /// </summary>
        /// <param name="project">采购项目</param>
        /// <returns>0失败;1成功</returns>
        /// <remarks>
        /// ID可以为空，其余字段一律不得为空
        /// 
        /// </remarks>
        int AddProcurementProject(ProcurementProject project);

        /// <summary>
        /// 更新采购项目信息（0失败;1成功）
        /// </summary>
        /// <param name="project">采购项目</param>
        /// <returns>0失败;1成功</returns>
        int UpdateProcurementProject(ProcurementProject project);


        /// <summary>
        /// 获取采购项目信息
        /// </summary>
        /// <param name="projectID">项目编号</param>
        /// <returns>0.不成功,1.成功,2.采购项目编号不存在,3.采购项目编号已经被使用</returns>
        ProcurementProject GetProcurementProjectByID(string projectID);

        /// <summary>
        /// 删除采购项目（0失败;1成功）
        /// </summary>
        /// <param name="projectID">项目编号</param>
        /// <returns>0失败;1成功</returns>
        int DeleteProcurementProjectByID(string projectID);


        #endregion

        #region 采购目录
        /// <summary>
        /// 获取所有采购目录
        /// </summary>
        /// <returns>所有采购目录信息</returns>
        IList<Model.View.ProcureCatalog> GetAllProcureCatalog();

        /// <summary>
        /// 条件查询采购目录信息（有效的【在采购项目有效期内】）
        /// </summary>
        /// <param name="procureCatalog">查询用实体</param>
        /// <param name="currentPage">当前页</param>
        /// <param name="pageSize">每页显示记录数</param>
        /// <param name="totalRecord">（输出参数）总记录数目</param>
        /// <returns>所有采购目录信息</returns>
        IList<HZ.DrugTrade.Model.View.ProcureCatalog> GetProcureCatalogByWhere(HZ.DrugTrade.Model.Query.ProcureCatalog procureCatalog, int currentpage, int pagesize, out int totalrecord);
        /// <summary>
        /// Table
        /// </summary>
        /// <param name="procureCatalog"></param>
        /// <param name="currentpage"></param>
        /// <param name="pagesize"></param>
        /// <param name="totalrecord"></param>
        /// <returns></returns>
        DataTable GetProcureCatalogByWhere1(HZ.DrugTrade.Model.Query.ProcureCatalog procureCatalog, int currentpage, int pagesize, out int totalrecord);
        /// <summary>
        /// 条件查询采购目录信息（有效的【在采购项目有效期内】）--带区域条件
        /// </summary>
        /// <param name="procureCatalog">查询用实体</param>
        /// <param name="currentPage">当前页</param>
        /// <param name="pageSize">每页显示记录数</param>
        /// <param name="totalRecord">（输出参数）总记录数目</param>
        /// <returns>所有采购目录信息</returns>
        IList<HZ.DrugTrade.Model.View.ProcureCatalog> GetProcureCatalogByWhereArea(string strAreaID, HZ.DrugTrade.Model.Query.ProcureCatalog procureCatalog, int currentpage, int pagesize, out int totalrecord);

        /// <summary>
        /// 根据登陆ID查询价格修改权限
        /// </summary>
        /// <param name="strUserID"></param>
        /// <returns></returns>
        DataTable GetTB_ManageOrg(string strUserID);


        /// <summary>
        /// 中心查看盟市价格
        /// </summary>
        /// <param name="strUserID"></param>
        /// <returns></returns>
        DataTable GetAreaProductList(string ProcureCatalogID);

        /// <summary>
        /// 盟市价格权限
        /// </summary>
        /// <param name="strUserID"></param>
        /// <returns></returns>
        DataTable GetAreaAccessPrice();

        /// <summary>
        /// 保存盟市价格权限
        /// </summary>
        /// <param name="strUserID"></param>
        /// <returns></returns>
        int ValidateAreaAccessPrice(List<ManageOrg> moList);

        /// <summary>
        /// 条件查询采购目录信息（有效的【在采购项目有效期内】）
        /// </summary>
        /// <param name="procureCatalog">查询用实体</param>
        /// <param name="currentPage">当前页</param>
        /// <param name="pageSize">每页显示记录数</param>
        /// <param name="totalRecord">（输出参数）总记录数目</param>
        /// <returns>所有采购目录信息</returns>
        System.Data.DataTable GetProcureCatalogDTByWhere(HZ.DrugTrade.Model.Query.ProcureCatalog procureCatalog, int currentpage, int pagesize, out int totalrecord);

        /// <summary>
        /// 条件查询采购目录信息（有效的【在采购项目有效期内】）
        /// </summary>
        /// <param name="procureCatalog">查询用实体</param>
        /// <param name="currentPage">当前页</param>
        /// <param name="pageSize">每页显示记录数</param>
        /// <param name="totalRecord">（输出参数）总记录数目</param>
        /// <returns>所有采购目录信息</returns>
        System.Data.DataTable GetProcureCatalogDTByWhere2(HZ.DrugTrade.Model.Query.ProcureCatalog procureCatalog, int currentpage, int pagesize, out int totalrecord);

        /// <summary>
        /// 条件查询采购目录信息（无效的【不在采购项目有效期内】）
        /// </summary>
        /// <param name="procureCatalog">查询用实体</param>
        /// <param name="currentPage">当前页</param>
        /// <param name="pageSize">每页显示记录数</param>
        /// <param name="totalRecord">（输出参数）总记录数目</param>
        /// <returns>所有采购目录信息</returns>
        IList<HZ.DrugTrade.Model.View.ProcureCatalog> GetInvalidProcureCatalogByWhere(HZ.DrugTrade.Model.Query.ProcureCatalog procureCatalog, int currentpage, int pagesize, out int totalrecord);


        /// <summary>
        /// 插入采购目录
        /// </summary>
        /// <param name="procureCatalog">采购目录【配送企业编号集合CompanyIDs_PS，配送企业名称集合CompanyNames_PS，采购目录编号ProcureCatalogID，商品编号GoodsID，中标价格ProcurePrice，采购项目编号ProjectID，为必填】</param>
        /// <returns>0失败；1成功；2该商品在项目中已经存在（商品在同一项目中只能存在一个采购目录）</returns>
        int AddProcureCatalog(ProcureCatalog procureCatalog);
        /// <summary>
        /// 插入采购目录 update by zdc 系统升级后目录为View_Procurecatalog_TB
        /// </summary>
        /// <param name="procureCatalog">采购目录【采购目录编号ProcureCatalogID，商品编号GoodsID，中标价格ProcurePrice，采购项目编号ProjectID，为必填】</param>
        /// <returns></returns>
        int AddProcureCatalog(ProcureCatalog procureCatalog, View_Procurecatalog_TB vpt);
        /// <summary>
        /// 插入采购目录【为Execl批量导入用】
        /// </summary>
        /// <param name="procureCatalog">采购目录【配送企业编号集合CompanyIDs_PS，配送企业名称集合CompanyNames_PS，采购目录编号ProcureCatalogID，商品编号GoodsID，中标价格ProcurePrice，采购项目编号ProjectID，为必填】</param>
        /// <returns>0失败；1成功；2该商品在项目中已经存在（商品在同一项目中只能存在一个采购目录）</returns>
        int AddProcureCatalogForBatch(ProcureCatalog procureCatalog);

        /// <summary>
        /// 插入采购目录（批量）
        /// </summary>
        /// <param name="procureCatalogs">采购目录集合【配送企业编号集合CompanyIDs_PS，配送企业名称集合CompanyNames_PS，采购目录编号ProcureCatalogID，商品编号GoodsID，中标价格ProcurePrice，采购项目编号ProjectID，为必填】</param>
        /// <returns></returns>
        int AddProcureCatalogs(IList<ProcureCatalog> procureCatalogs);


        /// <summary>
        /// 更新配送企业
        /// </summary>
        /// <param name="procureCatalog"></param>
        /// <returns></returns>
        int UpdateProcureCatalog_CompanyPS(ProcureCatalog procureCatalog);

        /// <summary>
        /// 更新中标价格
        /// </summary>
        /// <param name="procureCatalog">采购目录信息【中标价ProcurePrice，采购目录编号ProcureCatalogID，为必填】</param>
        /// <returns></returns>
        int UpdateProcureCatalog_ProcurePrice(ProcureCatalog procureCatalog, Model.AdjustPriceLog log);

        /// <summary>
        /// 修改来源
        /// </summary>
        /// <param name="procureCatalog">采购目录信息【目录来源SortSource（0.正常添加；1.临时目录），采购目录编号ProcureCatalogID必填】</param>
        /// <returns></returns>
        int UpdateProcureCatalog_SortSource(ProcureCatalog procureCatalog);

        /// <summary>
        /// 切换启用状态
        /// </summary>
        /// <param name="procureCatalog">采购目录信息【是否启用IsUsing（0否;1是），采购目录编号ProcureCatalogID必填】</param>
        /// <returns></returns>
        int UpdateProcureCatalog_IsUsing(ProcureCatalog procureCatalog);
        /// <summary>
        /// 切换启用状态 升级后View_ProcureCatalog_TB add by zdc
        /// </summary>
        /// <param name="procureCatalog">采购目录信息【是否启用IsUsing（0否;1是），采购目录编号ProcureCatalogID必填】</param>
        /// <returns></returns>
        int UpdateProcureCatalog_IsUsingZDC(View_Procurecatalog_TB procureCatalog);
        /// <summary>
        /// 获取采购目录信息
        /// </summary>
        /// <param name="procureCatalogID">采购目录编号【采购目录编号ProcureCatalogID必填】</param>
        /// <returns></returns>
        Model.View.ProcureCatalog GetProcureCatalogByID(string procureCatalogID);

        /// <summary>
        /// 删除采购目录（0失败;1成功）
        /// </summary>
        /// <param name="procureCatalogID">采购目录编号</param>
        /// <returns>0失败;1成功</returns>
        int DeleteProcureCatalogByID(string procureCatalogID);
        #endregion

        #region 调价计划
        /// <summary>
        /// 立即更新价格（0失败;1成功）
        /// </summary>
        /// <param name="plan">调价计划</param>
        /// <returns>0失败;1成功</returns>
         int UpdateProcureCatalog_Price(AdjustPricePlan plan);

         /// <summary>
         /// 盟市地区 立即更新价格（0失败;1成功）
         /// </summary>
         /// <param name="plan">调价计划</param>
         /// <returns>0失败;1成功</returns>
         int UpdateAreaProcureCatalog_Price(AdjustPricePlan plan, string ProjectID, string AreaID);

        /// <summary>
        /// 新增调价计划（0失败;1成功）
        /// </summary>
        /// <param name="plan">调价计划</param>
        /// <returns>0失败;1成功</returns>
        int AddAdjustPricePlan(AdjustPricePlan plan);

        /// <summary>
        /// 更新调价计划（0.不成功,1.成功,2.调价计划编号不存在）
        /// </summary>
        /// <param name="plan">调价计划</param>
        /// <returns>0失败;1成功</returns>
        int UpdateAdjustPricePlan(AdjustPricePlan plan);

        /// <summary>
        /// 删除调价计划（0.不成功,1.成功,2.调价计划编号不存在）
        /// </summary>
        /// <param name="planID">调价计划编号</param>
        /// <returns>0失败;1成功</returns>
        int DeleteAdjustPricePlanByID(string planID);

        /// <summary>
        /// 条件查询调价计划信息
        /// </summary>
        /// <param name="plan">查询用实体</param>
        /// <param name="currentPage">当前页</param>
        /// <param name="pageSize">每页显示记录数</param>
        /// <param name="totalRecord">（输出参数）总记录数目</param>
        /// <returns>所有采购目录信息</returns>
        IList<HZ.DrugTrade.Model.View.AdjustPricePlan> GetAdjustPricePlanByWhere(HZ.DrugTrade.Model.Query.AdjustPricePlan plan, int currentpage, int pagesize, out int totalrecord);
        /// <summary>
        /// 条件查询调价计划信息表 add by zdc 2011-10-21
        /// </summary>
        /// <param name="plan">查询用实体</param>
        /// <param name="currentPage">当前页</param>
        /// <param name="pageSize">每页显示记录数</param>
        /// <param name="totalRecord">（输出参数）总记录数目</param>
        /// <returns>所有采购目录信息</returns>
        System.Data.DataTable GetAdjustPricePlanDTByWhere(HZ.DrugTrade.Model.Query.AdjustPricePlan plan, int currentpage, int pagesize, out int totalrecord);

        /// <summary>
        /// 获取调价记录 zdc
        /// </summary>
        /// <param name="procurecatalogId">采购目录编号</param>
        /// <param name="currentPage">当前页</param>
        /// <param name="pageSize">每页显示数</param>
        /// <param name="totalRecord">总数</param>
        /// <returns></returns>
        IList<Model.AdjustPricePlan> GetAdjustPricePlanByWhere(string procurecatalogId, int currentPage, int pageSize, out int totalRecord);


        /// <summary>
        /// 获取一条调价目录 zdc
        /// </summary>
        /// <param name="procureCatalogID">采购目录编号</param>
        /// <returns></returns>
        HZ.DrugTrade.Model.AdjustPricePlan GetAdjustPricePlanByID(string procureCatalogID);

        #endregion

        #region 企业获取勾选目录
        
         
        #endregion

        /// <summary>
        /// 根据机构ID判断是否基层医疗机构 add by zdc
        /// </summary>
        /// <param name="orgID"></param>
        /// <returns></returns>
        bool GetIsJiCeng(string orgID);
        /// <summary>
        /// 提交/审核
        /// </summary>
        /// <param name="GoodsId"></param>
        /// <returns></returns>
        int SubmitProcureCatalogList(string GoodsId, int flag, string NoPassReson); 
         /// <summary>
        /// 修改
        /// </summary>
        /// <param name="GoodsId"></param>
        /// <returns></returns>
      int UpdateProcureCatalogList(Model.View.ProcureCatalog list); 
         /// <summary>
        /// 条件查询采购目录信息（有效的【在采购项目有效期内】）医疗机构
        /// add by Meng 2013-04-22 添加医疗机构设置的实际采购价格
        /// </summary>
        /// <param name="procureCatalog">查询用实体</param>
        /// <param name="currentPage">当前页</param>
        /// <param name="pageSize">每页显示记录数</param>
        /// <param name="totalRecord">（输出参数）总记录数目</param>
        /// <returns>所有采购目录信息</returns>
      IList<Model.View.ProcureCatalog> GetProcureCatalogByWhere_Hospital(HZ.DrugTrade.Model.Query.ProcureCatalog procurecatalog, string hospitalid, int currentPage, int pageSize, out int totalRecord);

    }
}
